﻿using Hvam.SharePoint.Search.Query.Site.Models;

namespace Hvam.SharePoint.Search.Query.Site.ResultSteps
{
    internal class IdResultStep : SiteSearchResultStep
    {
        private int Id { get; set; }

        public IdResultStep(SiteSearchQuery query) : base(query)
        {
            Id = 1;
        }

        public override SiteSearchResult Process(SiteSearchResult result)
        {
            if (!result.Properties.ContainsKey("id"))
            {
                result.Properties.Add("id", Id.ToString());

                Id++;
            }

            return result;
        }
    }
}
